package com.yulebaby.callsenter.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yulebaby.callsenter.R;
import com.yulebaby.callsenter.bean.TrackStepBean;
import com.yulebaby.callsenter.global.App;
import com.yulebaby.callsenter.utils.ImageLoader;

import java.util.List;

/**
 * Author: Zhangbo
 * Time: 2017/1/13
 * <p>
 * 跟踪记录适配器
 */
public class TrackStepAdapter extends BaseQuickAdapter<TrackStepBean, BaseViewHolder> {

    public TrackStepAdapter(List<TrackStepBean> list) {
        super(R.layout.item_track_mark, list);
    }


    @Override
    protected void convert(BaseViewHolder baseViewHolder, TrackStepBean bean) {
        baseViewHolder.getView(R.id.tv_selectedfile).setVisibility(bean.getFileCount() == 0 ? View.INVISIBLE : View.VISIBLE);
        baseViewHolder.setText(R.id.tv_trackprogress, bean.getTrackStep())
                .setText(R.id.tv_selectedfile, "已添加" + bean.getFileCount() + "个文件");

        ImageView selectedView = baseViewHolder.getView(R.id.iv_selected);

        switch (bean.getIsSelected()) {
            case 0:
                ImageLoader.load(App.mContext, R.drawable.tracerecord_normal, selectedView);
                break;
            case 1:
                ImageLoader.load(App.mContext, R.drawable.tracerecord_sure, selectedView);
                break;
            case 2:
                ImageLoader.load(App.mContext, R.drawable.tracerecord_false, selectedView);
                break;
        }
    }
}
